<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WebchatController
 *
 * @author wupeng
 */

include_once 'UserController.php';

class WebchatController extends UserController {
    //put your code here
    
    public function indexAction(){
        $this->appendScript('/js/jquery.min.js');
        $webChat = Application_Model_UnionUser_Base::createUnion('webchat');
        $this->view->validUrl = $webChat->getValidUrl();
        $this->view->qcodeCode = $webChat->getLoginCode();
        $this->view->webChatQcode = $webChat->getQcodeImage();
    }
    
    public function validAction(){
        $code = $this->getSafeParam('code');
        $webChat = Application_Model_UnionUser_Base::createUnion('webchat');
        $result = $webChat->valid($code);
        $this->json($result);
    }
    
    public function webchatbackAction(){
//        $webChat = Application_Model_UnionUser_Base::createUnion('webchat');
//        $result = $webChat->getUserInfo();
//        $this->json($result);
        $this->callback('webchat',"/user/bind");
    }
    
}
